<template>
  <div>
    <div style="margin-top: 15px;">
      <el-row>
        <el-col :span="22"><el-input placeholder="请输入项目名称"  v-model="projectNames" class="input-with-select">
    
  </el-input></el-col>
  <el-col :span="2"><el-button icon="el-icon-search" @click="GetProjectList()">搜索</el-button></el-col>
      </el-row>
  
</div>
    <el-table
      ref="multipleTable"
      v-loading="loading"
      :data="tableData"
      tooltip-effect="dark"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection"> </el-table-column>
      <el-table-column label="项目编号">
        <template v-slot="scope">
            <el-link type="primary" >{{scope.row.projectNumber}}</el-link>
        </template>
          </el-table-column>
      <el-table-column prop="projectName" label="项目名称"> </el-table-column>
      <el-table-column prop="projectLevel" label="项目级别" > </el-table-column>
      <el-table-column prop="projectUndertakeunit" label="项目承担单位"> </el-table-column>
      <el-table-column prop="projectPerson" label="负责人"> </el-table-column>
      <el-table-column prop="specialMoney" label="专项经费（万元）"> </el-table-column>
      <el-table-column prop="supportMoney" label="配套经费（万元）"> </el-table-column>
      <el-table-column prop="progress" label="项目进度">
          </el-table-column>
    <el-table-column label="操作">
      <template v-slot="scope">
        <el-link
          v-for="(item,index) in scope.row.operate"
          :key="index"
          size="mini"
          type="warning"
          @click="WorkFlow(index, item,scope.row.projectId)">{{item.name}}</el-link>&nbsp;&nbsp;
          <el-link size="mini" style="color:chocolate" type="primary" @click="ProjeckUpt(scope.row.projectId)" v-if="ProjeckName==scope.row.projectPerson && scope.row.progress=='审核未通过'">编辑</el-link>&nbsp;&nbsp;
          <!-- <el-link size="mini" type="primary" >编辑</el-link> -->
          <el-link
          size="mini"
          type="primary"
          @click="detail(scope.$index, scope.row)">详情</el-link>
      </template>
    </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="index"
      :page-sizes="[10, 15, 20, 25]"
      :page-size="size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="Total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading:false,
      tableData: [],
      multipleSelection: [],
      ProjeckName:JSON.parse(localStorage.getItem('user')).userName,
      // projectName:"",
      size:10,
      index:1,
      Total:0
    };
  },
  mounted() {
    this.GetProjectList()
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    GetProjectList()
    {
        this.loading=true;
        this.http.get('api/tb_project_baseinfo/GetProjectListAsync').then(
            res=>{
                console.log(res.data);
                this.tableData = res.data
                this.loading=false;
            }
        )
    },
    ProjeckUpt(val){
      this.$router.push('./src/views/system/UptApproval?id='+val)
    },
    detail(index, row) {
        console.log(index, row);
        this.$router.push('/DetailInfo?id='+row.projectId+'&orderId='+row.currentOrderId)
      },
      WorkFlow(index, row,id){
            console.log(row);
           this.$router.push('/ProjectAudit?id='+id+'&orderId='+row.field)
        
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
  },
};
</script>
<style>
/* .el-select .el-input {
  width: 130px;
} */

.input-with-select .el-input-group__prepend {
  background-color: #fff;
}
</style>